import { ajax } from '../http.js';
import { ajaxSync } from '../httpSync.js';

const inviteInfoUrl = '/authc/user_rank/find_invite_info';
const checkInviteByMobileUrl = '/authc/user_rank/check_invite_by_mobile';
const bindingInviteUrl = '/authc/user_rank/binding_invite';
const discernCardUrl = '/authc/user_qualification/v2/discern_card';
const parentReceiptUrl = '/authc/bankcard/find_user_parent_receipt';
const discernCharterUrl = '/authc/user_qualification/v2/discern_charter';
const saveInfoUrl = '/authc/user_upgrade_apply/join';
const reviewQualificationUrl = '/authc/user_qualificetion/find_review_qualification';
const findResultUrl = '/authc/user_upgrade_apply/find_more_by_user_id';
const getModifyUrl = '/authc/user_upgrade_apply/modify';
const findUserNumberUrl = '/authc/user_upgrade_apply/find_user_number';
const findByUserIdUrl = '/authc/user_upgrade_apply/find_by_user_id';
const payAgainUrl = '/authc/user_upgrade_apply/pay_again';

const inviteInfo = (data, success, fail) => { // 查询邀请人信息
  ajax({
    url: inviteInfoUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const checkInviteByMobile = (data, success, fail) => { // 校验邀请人
  ajax({
    url: checkInviteByMobileUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const bindingInvite = (data, success, fail) => { // 绑定邀请人
  ajax({
    url: bindingInviteUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const discernCard = (data, success, fail) => { // 身份证识别
  ajax({
    url: discernCardUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const parentReceipt = (data, success, fail) => { // 个人加盟===>查询公司对公银行账户
  ajax({
    url: parentReceiptUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const discernCharter = (data, success, fail) => { // 营业执照识别
  ajax({
    url: discernCharterUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const reviewQualification = (data, success, fail) => {
  ajax({
    url: reviewQualificationUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const saveInfo = (data, success, fail) => { // 初次加盟
  ajax({
    url: saveInfoUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getModify = (data, success, fail) => { // 修改加盟信息
  ajax({
    url: getModifyUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const findUserNumber = (data, success, fail) => { // 查询赠送的加盟名额
  ajax({
    url: findUserNumberUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const findByUserId = (data, success, fail) => { // 获取入住加盟的审核信息
  ajax({
    url: findByUserIdUrl,
    data: data,
    success: success,
    fail: fail
  });
};
const findResult = (data, success, fail) => { // 获取加盟审核信息
  ajax({
    url: findResultUrl,
    data: data,
    success: success,
    fail: fail
  });
};
const findResultSync = (data, success, fail) => { // 获取加盟审核信息====同步
  return ajaxSync({
    url: findResultUrl,
    data: data,
    success: success,
    fail: fail
  });
};
const payAgain = (data, success, fail) => { // 重新发起线上支付或提交打款凭证
  ajax({
    url: payAgainUrl,
    data: data,
    success: success,
    fail: fail
  });
};
export {
  inviteInfo,
  checkInviteByMobile,
  bindingInvite,
  discernCard,
  parentReceipt,
  discernCharter,
  saveInfo,
  reviewQualification,
  findResult,
  getModify,
  findUserNumber,
  findByUserId,
  findResultSync,
  payAgain
}